<?php
/**
 * @package      OWNServices
 * @subpackage   site
 *
 * @author       Sanawin Tinsuwan
 * @copyright    Copyright (C) 20014 Sanawin Tinsuwan. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
 */

defined('_JEXEC') or die();

// Set some global property
$document	= JFactory::getDocument();
$user			= JFactory::getUser();
$canDo		= $displayData->canDo;
$params		= $displayData->params;
$vName		= isset($displayData->vName)?$displayData->vName:'';


$document->addStyleSheet(JUri::base(true).'/media/com_ownservices/css/bootstrap.min.css');
$document->addStyleSheet(JUri::base(true).'/media/com_ownservices/css/font-awesome-4.3.0/css/font-awesome.min.css');

//Ionicons
$document->addStyleSheet(JUri::base(true).'/media/com_ownservices/css/ionicons-1.5.2/css/ionicons.min.css');

//Theme style
$document->addStyleSheet(JUri::base(true).'/media/com_ownservices/css/AdminLTE.css');
?>
<!-- header logo: style can be found in header.less -->
<header class="header">
    <a href="<?php echo JRoute::_('index.php?option=com_ownservices'); ?>" class="logo">
        <!-- Add the class icon to your logo image or logo icon to add the margining -->
        OWNServices
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>
        <div class="navbar-right">
            <ul class="nav navbar-nav">
                <!-- User Account: style can be found in dropdown.less -->
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="glyphicon glyphicon-user"></i>
                        <span><?php echo $user->get('name'); ?> <i class="caret"></i></span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- User image -->
                        <li class="user-header bg-light-blue">
                            <img src="img/avatar3.png" class="img-circle" alt="User Image" />
                            <p>
                                <?php echo $user->get('name'); ?>
                                <small>Member ID : <?php echo $user->get('username'); ?></small>
                            </p>
                        </li>
                        <!-- Menu Footer-->
                        <li class="user-footer">
                            <div class="pull-left">
                                <a href="#" class="btn btn-default btn-flat">Profile</a>
                            </div>
                            <div class="pull-right">
                                <form action="<?php echo JRoute::_('index.php?option=com_ownservices&task=user.logout'); ?>" method="post">
                                    <!--<a href="#" class="btn btn-default btn-flat">Sign out</a>-->
                                    <button type="submit" class="btn btn-default btn-flat">Sign out</button>
                                    <input type="hidden" name="return" value="<?php echo base64_encode(JRoute::_('index.php?option=com_ownservices')); ?>" />
                                   <?php echo JHtml::_('form.token'); ?>
                                </form>
                            </div>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
</header>

<div class="wrapper row-offcanvas row-offcanvas-left">

    <!-- Left side column. contains the logo and sidebar -->
    <aside class="left-side sidebar-offcanvas">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="img/avatar3.png" class="img-circle" alt="User Image" />
                </div>
                <div class="pull-left info">
                    <p>Hello, <?php echo $user->get('username'); ?></p>

                    <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                </div>
            </div>
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li<?php if($vName==''):echo ' class="active"';endif;?>>
                    <a href="<?php echo JRoute::_('index.php?option=com_ownservices'); ?>">
                        <i class="fa fa-dashboard"></i> <span><?php echo JText::_('COM_OWNSERVICES_HOME'); ?></span>
                    </a>
                </li>
                <li class="treeview<?php if ($vName=='today' || $vName=='failed' || $vName=='paid' || $vName=='corrected' || $vName=='approval' || $vName=='pending' || $vName=='cancelled' || $vName=='transferring' || $vName=='all'): echo " active"; endif; ?>">
                    <a href="#">
                        <i class="fa fa-th"></i>
                        <span><?php echo JText::_('COM_OWNSERVICES_FUND_TRANSFER'); ?></span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
                        <li<?php if($vName=='today'):echo ' class="active"';endif; ?>>
							<a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=todaytransactions'); ?>">
							<i class="fa fa-angle-double-right"></i> 
							<?php echo JText::_('COM_OWNSERVICES_TODAY_TRANSACTIONS'); ?> 
							<small class="badge pull-right bg-green">1</small>
						</a>
						</li>
                        <li<?php if($vName=='failed'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=failedtransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_FAILED_TRANSACTIONS'); ?></a></li>
                        <li<?php if($vName=='paid'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=paidtransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_PAID_TRANSACTIONS'); ?></a></li>
                        <li<?php if($vName=='corrected'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=correctedtransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_CORRECTED_TRANSACTIONS'); ?></a></li>
                        <li<?php if($vName=='approval'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=requestapprovals'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_REQUEST_APPROVAL'); ?></a></li>
                        <li<?php if($vName=='pending'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=pendingapprovals'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_APPROVAL_PENDING'); ?></a></li>
                        <li<?php if($vName=='cancelled'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=cancelledtransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_CANCELLED_TRANSACTIONS'); ?></a></li>
                        <li<?php if($vName=='transferring'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=transferringtransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_TRANSFERRING_TRANSACTIONS'); ?></a></li>
                        <li<?php if($vName=='all'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=alltransactions'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_ALL_TRANSACTIONS'); ?></a></li>
                    </ul>
                </li>

				<?php if($canDo->get('core.manage.members') || $canDo->get('core.manage.accounts') || $canDo->get('core.manage.staffs') ): ?>
                <li class="treeview<?php if ($vName=='members' || $vName=='accounts' || $vName=='staffs'): echo " active"; endif; ?>">
                    <a href="#">
                        <i class="fa fa-user"></i>
                        <span><?php echo JText::_('COM_OWNSERVICES_USERS'); ?></span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
						
						<?php if($canDo->get('core.manage.members')): ?>
                        <li<?php if($vName=='members'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=members'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_MEMBERS'); ?></a></li>
						<?php endif; ?>
						
						<?php if($canDo->get('core.manage.accounts')): ?>
                        <li<?php if($vName=='accounts'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=accounts'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_RECEIVER_ACCOUNTS'); ?></a></li>
						<?php endif; ?>

						<?php if($canDo->get('core.manage.staffs')): ?>
                        <li<?php if($vName=='staffs'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=staffs'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_STAFFS'); ?></a></li>
						<?php endif; ?>
                    </ul>
                </li>
				<?php endif; ?>

                <li class="treeview<?php if ($vName=='reports' || $vName=='reportmembers' || $vName=='reportstaffs'): echo " active"; endif; ?>">
                    <a href="#">
                        <i class="fa fa-file-text-o"></i>
                        <span><?php echo JText::_('COM_OWNSERVICES_REPORTS'); ?></span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
                        <li<?php if($vName=='reports'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=reports'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_REPORT_TRANSFER_MONEY_ALL'); ?></a></li>
                        <li<?php if($vName=='reportmembers'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=reportmembers'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_REPORT_TRANSFER_MONEY_MEMBER'); ?></a></li>
                        <li<?php if($vName=='reportstaffs'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=reportstaffs'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_REPORT_TRANSFERRER'); ?></a></li>
                    </ul>
                </li>
                <li class="treeview<?php if ($vName=='currencies' || $vName=='branches' || $vName=='rates' || $vName=='levels' || $vName=='points' || $vName=='options'): echo " active"; endif; ?>">
                    <a href="#">
                        <i class="fa fa-cogs"></i>
                        <span><?php echo JText::_('COM_OWNSERVICES_SETTINGS'); ?></span>
                        <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">
                        <li<?php if($vName=='currencies'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=currencies'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_CURRENCIES'); ?></a></li>
                        <li<?php if($vName=='branches'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=branches'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_BRANCHES'); ?></a></li>
                        <li<?php if($vName=='rates'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=exchangerates'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_EXCHANGE_RATES'); ?></a></li>
                        <li<?php if($vName=='levels'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=levels'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_VIP'); ?></a></li>
                        <li<?php if($vName=='points'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=points'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_POINT'); ?></a></li>
                        <li<?php if($vName=='options'):echo ' class="active"';endif; ?>><a href="<?php echo JRoute::_('index.php?option=com_ownservices&view=configuration'); ?>"><i class="fa fa-angle-double-right"></i> <?php echo JText::_('COM_OWNSERVICES_CONFIGURATION'); ?></a></li>
                    </ul>
                </li>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <?php echo $displayData->loadTemplate('header'); ?>
        </section>

        <!-- Main content -->
        <section class="content">
            <?php echo $displayData->loadTemplate('content'); ?>
        </section>
    </aside>

</div><!-- ./wrapper -->
